<template>
  <div class="mybox">
    <div class="topbox">
      <div class="topdiv">
        <div class="leftbox">
          <div class="toptitle">一般公共预算收入</div>
          <div class="topbg">
            <div class="topvalue">222</div>
            <div class="topunit">亿元</div>
          </div>
        </div>
        <div class="leftbox">
          <div class="toptitle">同比增速</div>
          <div class="topbg">
            <div class="topvalue btmvalue" :class="[checkSign(222)]">222%</div>
            <div class="topunit box" :class="[checkSigns(222)]"></div>
          </div>
        </div>
      </div>
      <div class="btmdiv">
        <div class="rouseline">
          <p>总量排名 第<span style="color: #ffde00;font-weight: 700;font-size: 16px;">10</span>名</p>
          <div>增速排名 第<span style="color: #ffde00;font-weight: 700;font-size: 16px;">10</span>名</div>
        </div>
        <div class="rouseline">
          <p>其中税收收入<span style="color: #ffde00;font-weight: 700;font-size: 16px;">102</span>亿元</p>
          <div class="btmvalues">同比 <div class="topunit box" :class="[checkSigns(222)]"></div>
          </div>
          <div class="topvalue btmvalue" :class="[checkSign(222)]">222%</div>
        </div>
      </div>
    </div>
    <div class="mybtmbox">
      <div class="leftbg" @click="leftClick"></div>
      <div class="mydiv" ref="cont">
        <div class="btmcard">
          <div class="btmboxs">
            <div class="boxtitle">税务部门税收收入（含海关代征）</div>
            <div class="mybtmvalues">
              <div class="letfvalue">
                <div class="leftnum">2222</div>
                <div class="leftunit">亿元</div>
              </div>
              <div class="rightvalue">
                <div class="box" :class="[checkSigns(222)]"></div>
                <div class="btmvalue" :class="[checkSign(222)]">222%</div>
              </div>
            </div>
          </div>
          <div class="btmboxs newbtmboxs">
            <div class="boxtitle">一般公共预算支出</div>
            <div class="mybtmvalues">
              <div class="letfvalue">
                <div class="leftnum">2222</div>
                <div class="leftunit">亿元</div>
              </div>
              <div class="rightvalue">
                <div class="box" :class="[checkSigns(222)]"></div>
                <div class="btmvalue" :class="[checkSign(222)]">222%</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="rightbg" @click="rightClick"></div>
    </div>
  </div>
</template>
<script>
export default {
  name: '',
  data () {
    return {}
  },
  methods: {
    checkSigns (numStr) {
      const num = parseFloat(numStr)
      return num >= 0 ? 'red' : 'green'
    },
    checkSign (numStr) {
      const num = parseFloat(numStr)
      return num >= 0 ? 'pos' : 'neg'
    },
    leftClick () {
      this.$refs.cont.scrollLeft -= 381
    },
    rightClick () {
      this.$refs.cont.scrollLeft += 381
    }
  }
}
</script>
<style lang="scss" scoped>
.mybox {
  .topbox {
    width: 408px;
    height: 164px;
    background: rgba(43, 101, 156, 0.3);
    border: 1px solid #2B659C;
    margin: 0 auto;
    padding-top: 5px;

    .topdiv {
      display: flex;
      justify-content: space-around;

      .leftbox {
        .toptitle {
          font-family: MicrosoftYaHeiUI;
          font-size: 16px;
          color: #FFFFFF;
          text-align: center;
        }

        .topbg {
          width: 130px;
          height: 78px;
          background: url('./img/13.png')no-repeat center center;
          padding-top: 10px;

          .topvalue {
            font-family: YouSheBiaoTiHei;
            font-size: 24px;
            color: #16fdf5;
            text-align: center;
          }

          .btmvalue {
            font-family: Source Han Sans CN;
            font-weight: bold;
            font-size: 16px;
            margin-top: 5px;

            &.pos {
              color: #FE3D3D;
            }

            &.neg {
              color: #03f842;
            }
          }

          .topunit {
            font-family: MicrosoftYaHeiUI;
            font-size: 14px;
            color: #FFFFFF;
            text-align: center;
            font-style: normal;
          }

          .box {
            width: 10px;
            height: 16px;
            margin: 0 auto;
            margin-top: 10px;

            &.red {
              background: url('../right/img/bgc.png')no-repeat center center;
              background-size: 100% 100%;
            }

            &.green {
              background: url('../right/img/bgc1.png')no-repeat center center;
              background-size: 100% 100%;
            }
          }
        }
      }
    }

    .btmdiv {
      width: 392px;
      height: 54px;
      background: url('./img/14.png')no-repeat center center;
      margin: 0 auto;
      padding-top: 5px;

      .rouseline {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        box-sizing: border-box;

        p {
          width: 64%;
          text-align: left;
          font-family: MicrosoftYaHeiUI;
          font-size: 14px;
          color: #FFFFFF;
          line-height: 22px;
        }

        div {
          text-align: left;
          font-family: MicrosoftYaHeiUI;
          font-size: 14px;
          color: #FFFFFF;
          line-height: 22px;
        }

        .btmvalue {
          font-family: Source Han Sans CN;
          font-weight: bold;
          font-size: 16px;
          margin-top: 5px;

          &.pos {
            color: #FE3D3D;
          }

          &.neg {
            color: #03f842;
          }
        }

        .btmvalues {
          display: flex;

          .box {
            width: 10px;
            height: 16px;
            margin: 0 auto;
            margin-left: 10px;
            margin-top: 3px;

            &.red {
              background: url('../right/img/bgc.png')no-repeat center center;
              background-size: 100% 100%;
            }

            &.green {
              background: url('../right/img/bgc1.png')no-repeat center center;
              background-size: 100% 100%;
            }
          }
        }
      }
    }
  }

  .mybtmbox {
    display: flex;
    padding: 0 10px;
    margin-top: 5px;

    .mydiv {
      overflow: hidden;
      transition: scroll 0.5s ease-in-out;

      .btmcard {
        display: flex;
        justify-content: space-between;
        width: calc(380px *2);
        height: 70px;


        .btmboxs {
          width: 361px;
          height: 70px;
          background: url('./img/15.png')no-repeat center center;
          background-size: 100% 100%;
          margin-left: 20px;
          padding-top: 10px;

          .boxtitle {
            font-family: MicrosoftYaHeiUI;
            font-size: 16px;
            color: #FFFFFF;
            padding-left: 20px;
          }

          .mybtmvalues {
            display: flex;
            justify-content: space-between;
            width: 100%;
            height: 60px;
            background: url('./img/14.png')no-repeat center center;
            background-size: 100% 100%;
            padding-top: 5px;
            padding-right: 20px;

            .letfvalue {
              display: flex;
              font-family: MicrosoftYaHeiUI;
              font-size: 14px;
              color: #FFFFFF;
              margin-left: 20px;

              .leftnum {
                color: #ffde00;
                font-weight: 700;
                font-size: 16px;
                margin-right: 5px;
              }
            }

            .rightvalue {
              display: flex;

              .box {
                width: 10px;
                height: 16px;
                margin: 0 auto;
                margin-top: 10px;

                &.red {
                  background: url('../right/img/bgc.png')no-repeat center center;
                  background-size: 100% 100%;
                }

                &.green {
                  background: url('../right/img/bgc1.png')no-repeat center center;
                  background-size: 100% 100%;
                }
              }

              .btmvalue {
                font-family: Source Han Sans CN;
                font-weight: bold;
                font-size: 16px;
                margin-top: 5px;

                &.pos {
                  color: #FE3D3D;
                }

                &.neg {
                  color: #03f842;
                }
              }
            }
          }
        }

        .newbtmboxs {
          margin-right: 20px;

        }
      }
    }

    .leftbg {
      width: 18px;
      height: 22px;
      background: url('./img/3.png')no-repeat center center;
      margin-top: 30px;
      cursor: pointer;
    }

    .rightbg {
      width: 18px;
      height: 22px;
      background: url('./img/4.png')no-repeat center center;
      margin-top: 30px;
      cursor: pointer;
    }
  }
}
</style>
